# run.py
from app.common.getticker import ticker_update_task,query_user_positions_task
from app import create_app, socketio
import sys
import os
import threading

sys.path.append(os.path.dirname(os.path.abspath(__file__)))
# 正确的使用方式
app = create_app('dev')  # 用 'prod' 替换 'dev' 切换到生产环境配置

if __name__ == '__main__':
    thread = threading.Thread(target=ticker_update_task)
    thread.start()
    thread1 = threading.Thread(target=query_user_positions_task)
    thread1.start()
    socketio.run(app, host='0.0.0.0', port=8100, allow_unsafe_werkzeug=True)
